package com.example.syssoft.config;


import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import javax.persistence.EntityNotFoundException;

@Slf4j
@RestControllerAdvice
public class ProjectExceptionAdvice {

    @ExceptionHandler
    public Result doEXxception(NullPointerException exception){
        log.info(exception.toString());
        exception.printStackTrace();
        return new Result(false,"查无此实体");
    }

    @ExceptionHandler
    public Result doENxception(EntityNotFoundException exception){
        log.info(exception.toString());
        exception.printStackTrace();
        return new Result(false,"查无此实体");
    }
}
